package com.lsu.app.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lsu.app.bean.Comment;
import com.lsu.app.service.CommentService;
import com.lsu.app.mapper.CommentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 *
 * @description 针对表【comment(评论)】的数据库操作Service实现
 * @Date 2023-10-18 20:25:44
 * @author hjj
 */
@Service
public class CommentServiceImpl extends ServiceImpl<CommentMapper, Comment> implements CommentService{


    private final CommentMapper commentMapper;

    public CommentServiceImpl(CommentMapper commentMapper){this.commentMapper=commentMapper;}


    @Override
    public void addHeatById(Integer id, Integer amount) {
        commentMapper.addHeatById(id,amount);
    }

    @Override
    public Integer getTeacherIdByCourseId(Integer courseId) {
        return commentMapper.getTeacherIdByCourseId(courseId);
    }

    @Override
    public Integer getUserIdByCourseVideoId(Integer id) {
        return commentMapper.getUserIdByCourseVideoId(id);
    }

    @Override
    public Integer getCountByTypeAndLinkId(Integer type, Integer linkId) {
        return commentMapper.getCountByTypeAndLinkId(type, linkId);
    }

    @Override
    public Integer CountCommentsByTeacherId(Integer teacherId) {
        return commentMapper.CountCommentsByTeacherId(teacherId);
    }

}




